---
title: Comments
icon: MessageSquareMore
---

import { IconWrapper } from '@/components/icon-wrapper'

<MetaData
  lang="en-US"
  meta={{
    preset: [{
      client: '@univerjs/preset-docs-thread-comment',
      locale: '@univerjs/preset-docs-thread-comment/locales/en-US',
      style: '@univerjs/preset-docs-thread-comment/lib/index.css',
    }],
    plugins: [{
      client: '@univerjs/thread-comment',
    }, {
      client: '@univerjs/thread-comment-ui',
      locale: '@univerjs/thread-comment-ui/locales/en-US',
      style: '@univerjs/thread-comment-ui/lib/index.css',
    }, {
      client: '@univerjs/docs-thread-comment-ui',
      style: '@univerjs/docs-thread-comment-ui/lib/index.css',
    }],
    server: 'Optional',
  }}
/>

Comments allow users to add comments and replies within documents, facilitating communication and collaboration among team members.

## Preset Mode

### Installation

```package-install
npm install @univerjs/preset-docs-thread-comment
```

### Usage

```typescript
import { UniverDocsCorePreset } from '@univerjs/preset-docs-core'
import UniverPresetDocsCoreEnUS from '@univerjs/preset-docs-core/locales/en-US'
import { UniverDocsThreadCommentPreset } from '@univerjs/preset-docs-thread-comment' // [!code ++]
import UniverPresetDocsThreadCommentEnUS from '@univerjs/preset-docs-thread-comment/locales/en-US' // [!code ++]
import { createUniver, LocaleType, mergeLocales } from '@univerjs/presets'

import '@univerjs/preset-docs-core/lib/index.css'
import '@univerjs/preset-docs-thread-comment/lib/index.css' // [!code ++]

const { univerAPI } = createUniver({
  locale: LocaleType.EN_US,
  locales: {
    [LocaleType.EN_US]: mergeLocales(
      UniverPresetDocsCoreEnUS,
      UniverPresetDocsThreadCommentEnUS, // [!code ++]
    ),
  },
  presets: [
    UniverDocsCorePreset(),
    UniverDocsThreadCommentPreset(), // [!code ++]
  ],
})
```

#### Using with Collaboration Feature <IconWrapper className="inline-flex" type="pro" size="xs" icon={null} />

If you are using the [collaboration](/guides/docs/features/collaboration) feature with `UniverDocsCollaborationPreset`, make sure to pass the `collaboration: true` option in `UniverDocsThreadCommentPreset`:

```typescript
UniverDocsThreadCommentPreset({
  collaboration: true, // [!code ++]
})
```

{/* ### Presets and Configuration */}

## Plugin Mode

### Installation

```package-install
npm install @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs/docs-thread-comment-ui
```

### Usage

```typescript
import { LocaleType, mergeLocales, Univer } from '@univerjs/core'
import { UniverDocsThreadCommentUIPlugin } from '@univerjs/docs-thread-comment-ui' // [!code ++]
import { UniverThreadCommentPlugin } from '@univerjs/thread-comment' // [!code ++]
import { UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui' // [!code ++]
import ThreadCommentUIEnUS from '@univerjs/thread-comment-ui/locale/en-US' // [!code ++]

import '@univerjs/thread-comment-ui/lib/index.css' // [!code ++]

const univer = new Univer({
  locale: LocaleType.EN_US,
  locales: {
    [LocaleType.EN_US]: mergeLocales(
      ThreadCommentUIEnUS, // [!code ++]
    ),
  },
})

univer.registerPlugin(UniverThreadCommentPlugin) // [!code ++]
univer.registerPlugin(UniverThreadCommentUIPlugin) // [!code ++]
univer.registerPlugin(UniverDocsThreadCommentUIPlugin) // [!code ++]
```

#### Using with Collaboration Feature <IconWrapper className="inline-flex" type="pro" size="xs" icon={null} />

If you are using the [collaboration](/guides/docs/features/collaboration) feature, configure it as follows:

```package-install
npm install @univerjs-pro/thread-comment-datasource
```

```typescript
import { UniverThreadCommentDataSourcePlugin } from '@univerjs-pro/thread-comment-datasource' // [!code ++]

univer.registerPlugin(UniverThreadCommentDataSourcePlugin) // [!code ++]
```

{/* ### Plugins and Configuration */}
